package org.therandoms.textgen;

import java.io.Serializable;
import java.util.LinkedList;

/**
 * A simple structure for passing options to wordnik.
 * 
 * @author Logan Widick
 * @author Vinh Pham
 */
public class WordnikOptions implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * 
	 * @author logan
	 *
	 */
	public enum WordnikSortOrder implements Serializable {
		ASC("asc"), DESC("desc");

		String value;

		WordnikSortOrder(String value) {
			this.value = value;
		}

		@Override
		public String toString() {
			return this.value;
		}
	}

	/**
	 * 
	 * @author logan
	 *
	 */
	public enum WordnikSortBy implements Serializable {
		ALPHA("alpha"), COUNT("count");

		String value;

		WordnikSortBy(String value) {
			this.value = value;
		}

		@Override
		public String toString() {
			return this.value;
		}
	}

	/**
	 * The dictionary to load
	 */
	public TextGeneratorDictionary<String> dictionaryToLoad;
	
	/**
	 * The categories to include
	 */
	public LinkedList<String> wordnikCategoriesToInclude = new LinkedList<String>();
	
	/**
	 * The categories to exclude
	 */
	public LinkedList<String> wordnikCategoriesToExclude = new LinkedList<String>();
	
	/**
	 * The production in the grammar to load
	 */
	public String grammarCategoryToLoad;
	
	/**
	 * The order to use when sorting results
	 */
	public WordnikSortOrder sortOrder;
	
	/**
	 * 
	 */
	public WordnikSortBy sortBy;
	
	/**
	 * If true, only use words that have dictionary definitions. 
	 */
	public boolean hasDictionaryDef = true;
	
	/**
	 * the minimum corpus count
	 */
	public int minCorpusCount = 0;
	
	/**
	 * the maximum corpus count
	 */
	public int maxCorpusCount = -1;
	
	/**
	 * the minimum dictionary count
	 */
	public int minDictionaryCount = 0;
	
	/**
	 * the maximum dictionary count
	 */
	public int maxDictionaryCount = -1;
	
	/**
	 * The minimum allowed word length
	 */
	public int minWordLength = 0;
	
	/**
	 * The maximum allowed word length
	 */
	public int maxWordLength = -1;
	
	/**
	 * The maximum number of words to pull in each category
	 */
	public int numResultsDesired = 100;
	
	/**
	 * If true, enable bad words filtering. 
	 */
	public boolean enableBadWordsFiltering = true;
	
	/**
	 * The API key
	 */
	public String wordnikAPIKey = null;

	public WordnikOptions(TextGeneratorDictionary<String> dictionaryToLoad,
			WordnikSortOrder sortOrder, WordnikSortBy sortBy) {
		super();
		this.dictionaryToLoad = dictionaryToLoad;
		this.sortOrder = sortOrder;
		this.sortBy = sortBy;
	}

}
